package bod.gui.menu;

import java.awt.Color;
import java.awt.Graphics;
import java.util.ArrayList;

import bod.gui.Screen;
import bod.gui.ScreenListener;
import bod.gui.menu.items.Item;

public abstract class Menu implements ScreenListener {

	protected ArrayList<Item>	items;

	public Menu() {
		this.items = new ArrayList<Item>();
	}

	public void draw(Graphics g) {
		g.setColor(Color.black);
		g.fillRect(0, 0, Screen.getWidth(), Screen.getHeight());
		for (Item item : this.items) {
			item.draw(g);
		}
	}

	@Override
	public void keyPressed(int key) {
		for (Item item : this.items) {
			item.keyPressed(key);
		}
	}

	@Override
	public void keyReleased(int key) {
		for (Item item : this.items) {
			item.keyReleased(key);
		}
	}

	@Override
	public void mousePressed(int x, int y) {
		for (Item item : this.items) {
			item.mousePressed(x, y);
		}
	}

	@Override
	public void mouseReleased(int x, int y) {
		for (Item item : this.items) {
			item.mouseReleased(x, y);
		}
	}

	@Override
	public void mouseMoved(int x, int y) {
		for (Item item : this.items) {
			item.mouseMoved(x, y);
		}
	}

}